package com.ant.storage.service.impl;

import com.aliyun.tea.utils.StringUtils;
import com.ant.storage.common.ResultCode;
import com.ant.storage.dto.CnxjrjzDto;
import com.ant.storage.handler.AntException;
import com.ant.storage.mapper.CnaccountMapper;
import com.ant.storage.pojo.Cnaccount;
import com.ant.storage.service.ICnaccountService;
import com.ant.storage.service.IDataMsgService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CnaccountServiceImpl extends ServiceImpl<CnaccountMapper, Cnaccount> implements ICnaccountService {

    @Autowired
    private IDataMsgService dataMsgService;

    @Override
    public List<Cnaccount> getList(CnxjrjzDto dto) throws Exception {
//        dataMsgService.changeDb(dto.getCityId());
        if(dto.getFkmId()==null || StringUtils.isEmpty(dto.getFkmId())){
            throw new AntException(ResultCode.FAILURE.getCode(),"科目id不能为空");
        }
        dataMsgService.changeDb(100);
        return  this.baseMapper.selectList(new QueryWrapper<Cnaccount>().eq("FKmID",dto.getFkmId()));
    }
}
